/*
 * @Descripttion: 验证是否产生错误
 * @version: 1.0
 * @Author: 自由如风
 * @Date: 2021-04-27 17:23:30
 * @LastEditors: 自由如风
 * @LastEditTime: 2021-05-05 10:10:15
 */

const { Fail } = require('../../lib/Response')
module.exports = async function (ctx, next) {
    if (ctx.errors) {
        ctx.body = new Fail('验证失败', ctx.errors, 501)
        return;
    } else {
        await next();
    }
}